<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ include file="/common/taglibs.jsp" %>
<c:choose>
	<c:when test="${pageContext.request.remoteUser eq null}">
		<div class="container_16">
			<div class="grid_4" align="left">
				<div class="logo"></div>
			</div>
			<div class="grid_12" align="right">
				<form id="loginForm" action="${ctx }/j_security_check" method="post" onsubmit="saveUsername(this);return validateForm(this)">
					<table class="login">
						<tr>
							<td>
								电子邮件
							</td>
							<td colspan="2">
								密码
							</td>
						</tr>
						<tr>
							<td>
								<input id="j_username" name="j_username" type="text" class="text"/>
							</td>
							<td>
								<input id="j_password" name="j_password" type="password" class="text" />
							</td>
							<td>
								<label class="btn"><input name="login" type="submit" value="登录" /></label>
								<c:if test="${param.error != null}">
								    <label>
								        <fmt:message key="errors.password.mismatch"/>
								    </label>
								</c:if>
							</td>
						</tr>
						<tr>
							<td>
								<c:if test="${appConfig['rememberMeEnabled']}">
									<label style="margin-left: -3px;"><input id="rememberMe" name="_spring_security_remember_me" type="checkbox" style="vertical-align: -2px;_vertical-align: -1px;margin-right: 2px;" /><span>保持在登录状态</span></label>
								</c:if>	
							</td>
							<td colspan="2">
								<span><a href="">忘记密码了？</a></span>
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</c:when>
	<c:otherwise>
		<div class="container_16">
			<div class="grid_8" align="left">
				<div class="logo"></div>
				<div class="user">
					<c:if test="${pageContext.request.remoteUser != null}">
			        	欢迎您，${currentUser.displayName }
			        	<c:if test="${currentRole.roleType.id ne 1 }">
				        	<img alt="" src="${ctx }/images/gear_gray.png">
				        	<a href="${ctx }/editUserInfo.html">设置</a>
			        	</c:if>			        	
			        	 | 
			        	<a href="${ctx }/logout.html">退出</a>
			        </c:if>
				</div>
			</div>
			<div class="grid_8" align="right">
				<img style="margin-top: 8px;" alt="" src="${ctx }/images/advertising.png">
			</div>
		</div>
	</c:otherwise>
</c:choose>

<%@ include file="/scripts/login.js"%>
